package com.java.al.date;


import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class DateStyle {
	
	public int getDays(GregorianCalendar g1, GregorianCalendar g2) {
		  int elapsed = 0;
		  GregorianCalendar gc1, gc2;

		  if (g2.after(g1)) {
		   gc2 = (GregorianCalendar) g2.clone();
		   gc1 = (GregorianCalendar) g1.clone();
		  } else {
		   gc2 = (GregorianCalendar) g1.clone();
		   gc1 = (GregorianCalendar) g2.clone();
		  }

		  gc1.clear(Calendar.MILLISECOND);
		  gc1.clear(Calendar.SECOND);
		  gc1.clear(Calendar.MINUTE);
		  gc1.clear(Calendar.HOUR_OF_DAY);

		  gc2.clear(Calendar.MILLISECOND);
		  gc2.clear(Calendar.SECOND);
		  gc2.clear(Calendar.MINUTE);
		  gc2.clear(Calendar.HOUR_OF_DAY);

		  while (gc1.before(gc2)) {
		   gc1.add(Calendar.DATE, 1);
		   elapsed++;
		  }
		  return elapsed;
		 }


	public void formatDate( Date date)
	{
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
		String s = sdf.format(date);
		System.out.println( s );
	}
	public static void main(String[] args) {
		DateStyle ds = new DateStyle();
//		System.out.println( ds.date );
		Date date = new Date();
		ds.formatDate(date);
		
		int result = 0;



	}
}
